<html>
<head>
    <meta charset="UTF-8">
    <title>测试</title>
</head>
<body>
    <table id="table"></table>
</body>
<script type="text/javascript" src="jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="layer/layer.js"></script>
<script type="text/javascript" src="royui.js"></script>
<script type="text/javascript">
    $(function (){
        $data = [{'code': 110000, 'name': '北京', 'has_children': 1}, {'code': 410000, 'name': '河南省'}, {'code': 420000, 'name': '湖北省', 'has_children': 1}]
        let r = new royui();
        r.render({
            elem: '#table',
            url: 'http://localhost/data.php',
            data: $data,
            method: 'post',
            cols: [
                {
                    field: 'name',
                    title: '区划名称',
                    title_style: 'text-align:left',
                    style: 'width: 300px'
                },
                {
                    field: 'code',
                    title: '区划编码',
                    title_style: 'text-align:left;width:200px'
                },
                {
                    title: '操作',
                    action: [{'matter': 'info', 'url': 'https://www.baidu.com', 'method': 'popup', 'area': ['300px', '400px']}, {'matter': 'edit', 'url': 'http://localhost/tree/edit.html', 'method': 'popup'}, {'matter': 'del', 'url': 'http://localhost/data.php', 'method': 'popup'}]
                }
            ],
            tree: {
                iconIndex: 0,
                primary_key: 'code'
            }
        })
    })
</script>
</html>